# Maintainer: psykose <alice@ayaya.dev>
pkgname=anime4kcpp
pkgver=2.5.0
pkgrel=2
_cmdline=98ec5a291ce824ba6315537ae13e81a45d374e7c
pkgdesc="High performance anime upscaler"
url="https://github.com/TianZerL/Anime4KCPP"
# s390x/ppc64le: opencv
arch="all !s390x !ppc64le"
license="MIT"
makedepends="
	boost-dev
	cmake
	eigen-dev
	libtbb-dev
	opencl-dev
	opencv-dev
	samurai
	"
subpackages="$pkgname-gui $pkgname-libs"
source="https://github.com/TianZerL/Anime4KCPP/archive/refs/tags/v$pkgver/Anime4KCPP-v$pkgver.tar.gz
	cmdline-$_cmdline.tar.gz::https://github.com/TianZerL/cmdline/archive/$_cmdline.tar.gz"
builddir="$srcdir/Anime4KCPP-$pkgver"
options="!check" # no tests

prepare() {
	default_prepare

	mkdir -p "$builddir"/ThirdParty/include
	ln -sfv "$srcdir"/cmdline-$_cmdline/cmdline.h \
		"$builddir"/ThirdParty/include/cmdline.h
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release \
		-DBuild_GUI=ON \
		-DUse_Boost_filesystem=ON \
		-DUse_TBB=ON

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	# the translations are installed to usr/bin/language, too lazy to fix
	rm -rf "$pkgdir"/usr/bin/language
}

gui() {
	pkgdesc="$pkgdesc (gui client)"

	amove usr/bin/Anime4KCPP_GUI
}

libs() {
	default_libs

	amove usr/lib/libAnime4KCPPCore.so
}

sha512sums="
a8471c6d6988f54b1be919d2b85b6ad697a96febfaaeec6f9a0d5df75b828cada3febcf6f122eb29bee2dd19a09b095db585c53f4525d46ede392efa03d7e7a4  Anime4KCPP-v2.5.0.tar.gz
7a3498974d2e963f67308c2df56975dda0e6a4adad617a051fead8ec2ec3b3ff597ad8a545764b66267cbf43f5f4973fc5c46767bda17d8897b573839e407bc2  cmdline-98ec5a291ce824ba6315537ae13e81a45d374e7c.tar.gz
"
